﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Restaurant.DTO;
using Restaurant.BUS;

namespace Restaurant
{
    public partial class frmTaoTaiKhoan : Form
    {
        public NhanVien nv = new NhanVien();
        public NhanVienService nvService = new NhanVienService();
        public bool ok = false;

        public frmTaoTaiKhoan()
        {
            InitializeComponent();
        }

        private void btnTao_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text != "" && txtPass.Text != "")
            {
                nv.Username = txtUsername.Text;
                nv.Password = txtPass.Text;
                if(nvService.CapNhatNVLostUpdate(nv))
                {
                    ok = true;
                    Close();
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("Lỗi");
                return;
            }
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
